<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0",shrink-to-fit=no>

    <!--
    踩坑：
    127.0.0.1 - - [11/Nov/2024 09:34:20] "GET /assets/plugins/bootstrap-5.3.2/bootstrap.min.css HTTP/1.1" 304 -
    127.0.0.1 - - [11/Nov/2024 09:34:20] "GET /assets/plugins/jquery-3.7.1/jquery.js HTTP/1.1" 304 -
    127.0.0.1 - - [11/Nov/2024 09:34:20] "GET /assets/plugins/bootstrap-5.3.2/bootstrap.bundle.min.js HTTP/1.1" 304 -
    样式路径写 “绝对路径” 其他html文件引用时，才不会报错
    -->
    <link rel="stylesheet" href="/assets/plugins/bootstrap-5.3.2/bootstrap.min.css">
    <script src="/assets/plugins/bootstrap-5.3.2/bootstrap.bundle.min.js"></script>
    <script src="/assets/plugins/jquery-3.7.1/jquery.js"></script>
    <script src="/assets/plugins/showdownjs-2.0.0/showdown.min.js"></script>
    <style>
        pre {
            white-space: pre-wrap;          /* css-3 */
            white-space: -moz-pre-wrap;     /* Mozilla, since 1999 */
            white-space: pre-wrap;          /* Opera 4-6 */
            white-space: -o-pre-wrap;       /* Opera 7 */
            word-wrap: break-word;          /* Internet Explorer 5.5+ */
            background-color: #f8f8f8;
            border: 1px solid #dfdfdf;
            margin-top: 1.5em;
            margin-bottom: 1.5em;
            padding: 1.25rem 0.3125rem 0.0625rem;
        }

        pre code {
            background-color: transparent;
            border: 0;
            padding: 0;
        }
    </style>
    <title>
        {% block title %}
        {% endblock %}
    </title>
</head>
<body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark ps-4 pe-4">
      <a class="navbar-brand" href="{{ url_for('home_page') }}">博客主页</a>
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarNav">
        <ul class="navbar-nav me-auto">
            <li class="nav-item active">
                <a class="nav-link" href="{{ url_for('home_page') }}">主页</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{{ url_for('about_page') }}">关于</a>
            </li>
        </ul>
        {% if current_user.is_authenticated %}
        <ul class="navbar-nav">
           <li class="nav-item">
               <a class="nav-link" href="{{ url_for('images_page') }}">图片管理</a>
            </li>
            <li class="nav-item">
               <a class="nav-link" href="{{ url_for('create_article_page') }}">发布新文章</a>
            </li>
            <li class="nav-item">
               <a class="nav-link" href="{{ url_for('logout_page') }}">退出</a>
            </li>
        </ul>
        {% else %}
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" href="{{ url_for('login_page') }}">登录</a>
            </li>
        </ul>
        {% endif %}
      </div>
     </nav>
    {% with messages = get_flashed_messages(with_categories=true) %}
     {% if messages %}
        {% for category, message in messages %}
            <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
                {{ message }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        {% endfor %}
    {% endif %}
    {% endwith %}
{% block content %}
{% endblock %}
</body>
</html>